#include <iostream>

int x1, y1, r1, x2, y2, r2;

int main()
{
    int T; std::cin >> T;
    while (T--) {
        std::cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
        if (x1 == x2 && y1 == y2) {
            if (r1 == r2) std::cout << "-1\n";
            else std::cout << "0\n";
        } else {
            int dis_sqr = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
            int t = (r1 + r2) * (r1 + r2);
            int t1 = (r1 - r2) * (r1 -r2);
            if (dis_sqr > t)
                std::cout << "4\n";
            else if (dis_sqr == t)
                std::cout << "3\n";
            else if (dis_sqr > t1)
                std::cout << "2\n";
            else if (dis_sqr == t1)
                std::cout << "1\n";
            else
                std::cout << "0\n";
        }
    }
}

